home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / spsoun / spsound.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  6.6 KB  |  235 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Demo for Sound .DLL Routines"
  4.    ClientHeight    =   3720
  5.    ClientLeft      =   720
  6.    ClientTop       =   2895
  7.    ClientWidth     =   6000
  8.    Height          =   4125
  9.    Left            =   660
  10.    LinkMode        =   1  'Source
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   3720
  13.    ScaleWidth      =   6000
  14.    Top             =   2550
  15.    Width           =   6120
  16.    Begin CommandButton Command2 
  17.       Caption         =   "Quit"
  18.       Height          =   495
  19.       Left            =   2145
  20.       TabIndex        =   1
  21.       Top             =   3045
  22.       Width           =   1695
  23.    End
  24.    Begin CommandButton Command6 
  25.       Caption         =   "spChirp"
  26.       Height          =   420
  27.       Left            =   4725
  28.       TabIndex        =   9
  29.       Top             =   1845
  30.       Width           =   945
  31.    End
  32.    Begin CommandButton Command5 
  33.       Caption         =   "spNoise"
  34.       Height          =   420
  35.       Left            =   255
  36.       TabIndex        =   8
  37.       Top             =   1815
  38.       Width           =   945
  39.    End
  40.    Begin PictureBox Picture1 
  41.       BorderStyle     =   0  'None
  42.       Height          =   540
  43.       Left            =   2640
  44.       Picture         =   SPSOUND.FRX:0000
  45.       ScaleHeight     =   540
  46.       ScaleWidth      =   600
  47.       TabIndex        =   4
  48.       Top             =   1500
  49.       Width           =   600
  50.    End
  51.    Begin CommandButton Command7 
  52.       Caption         =   "spNosound"
  53.       Height          =   420
  54.       Left            =   4725
  55.       TabIndex        =   10
  56.       Top             =   1065
  57.       Width           =   945
  58.    End
  59.    Begin CommandButton Command4 
  60.       Caption         =   "spSound"
  61.       Height          =   420
  62.       Left            =   255
  63.       TabIndex        =   7
  64.       Top             =   1050
  65.       Width           =   945
  66.    End
  67.    Begin CommandButton Command1 
  68.       Caption         =   "Demo All"
  69.       Height          =   420
  70.       Left            =   4725
  71.       TabIndex        =   0
  72.       Top             =   285
  73.       Width           =   945
  74.    End
  75.    Begin CommandButton Command3 
  76.       Caption         =   "spTone"
  77.       Height          =   420
  78.       Left            =   255
  79.       TabIndex        =   6
  80.       Top             =   285
  81.       Width           =   945
  82.    End
  83.    Begin Label Label3 
  84.       Alignment       =   2  'Center
  85.       FontBold        =   -1  'True
  86.       FontItalic      =   0   'False
  87.       FontName        =   "MS Sans Serif"
  88.       FontSize        =   9.75
  89.       FontStrikethru  =   0   'False
  90.       FontUnderline   =   0   'False
  91.       ForeColor       =   &H00FFFFFF&
  92.       Height          =   330
  93.       Left            =   1020
  94.       TabIndex        =   5
  95.       Top             =   3270
  96.       Width           =   4290
  97.    End
  98.    Begin Label Label4 
  99.       Alignment       =   2  'Center
  100.       Caption         =   "Submitted July 8th, 1991 By Alfred J. Giordano"
  101.       Height          =   435
  102.       Left            =   1800
  103.       TabIndex        =   11
  104.       Top             =   2220
  105.       Width           =   2445
  106.    End
  107.    Begin Label Label2 
  108.       Alignment       =   2  'Center
  109.       Caption         =   "Adapted from 'C' routines which appeared in the MAY 1990 Issue of Inside Turbo C"
  110.       Height          =   750
  111.       Left            =   1635
  112.       TabIndex        =   3
  113.       Top             =   735
  114.       Width           =   2775
  115.    End
  116.    Begin Label Label1 
  117.       Alignment       =   2  'Center
  118.       AutoSize        =   -1  'True
  119.       Caption         =   "SpSound"
  120.       FontBold        =   -1  'True
  121.       FontItalic      =   0   'False
  122.       FontName        =   "MS Sans Serif"
  123.       FontSize        =   18
  124.       FontStrikethru  =   0   'False
  125.       FontUnderline   =   0   'False
  126.       Height          =   435
  127.       Left            =   2100
  128.       TabIndex        =   2
  129.       Top             =   195
  130.       Width           =   1620
  131.    End
  132. Sub Command1_Click ()
  133.   Call Do_Noise
  134. End Sub
  135. Sub Command2_Click ()
  136.    End
  137. End Sub
  138. Sub Command3_Click ()
  139.    ' Makes a continuous Tone
  140.    ' 330  = Length (counts) for a 1/2 Cycle
  141.    ' 1000 = Number of Cycles or Duration
  142.    Call spTone(330, 1000)
  143.    Call spTone(440, 1000)
  144.    Call spTone(660, 1000)
  145. End Sub
  146. Sub Command4_Click ()
  147.    ' starts a continuous tone
  148.    ' 440 = desired frequency
  149.    ' use spNosound to stop tone.
  150.    Call spSound(440)
  151. End Sub
  152. Sub Command5_Click ()
  153.    Static BeenHere
  154.    ' Create a hissing noise or White Noise
  155.    ' 1000000 = Total number of counts to delay.
  156.    If BeenHere Then
  157.       BeenHere = 0
  158.       Call spNoise(1000000)
  159.    Else
  160.       BeenHere = 1
  161.       Call spNoise(10000)
  162.    End If
  163. End Sub
  164. Sub Command6_Click ()
  165.    Static BeenHere
  166.    ' Sound Glides Down like a Siren
  167.    ' 220 = Starting Frequency
  168.    ' 440 = Starting Frequency
  169.    ' 10  = Cycles of Each Frequency
  170.    If BeenHere Then
  171.       Call spChirp(220, 440, 10)
  172.       BeenHere = 0
  173.    Else
  174.       Call spChirp(440, 220, 10)
  175.       BeenHere = -1
  176.    End If
  177. End Sub
  178. Sub Command7_Click ()
  179.    ' Terminate all Sound Functions
  180.    Call spNosound
  181. End Sub
  182. Sub Delay (Ticks)
  183.   For i = 1 To Ticks
  184.   Next i
  185. End Sub
  186. Sub Do_Noise ()
  187.    Const Pause = 2000
  188.    ' ------------------------------------------
  189.    ' Demo of (Sp) Sound Functions
  190.    ' ------------------------------------------
  191.    ' Sound Glides Down like a Siren
  192.    ' 220 = Starting Frequency
  193.    ' 440 = Starting Frequency
  194.    ' 10  = Cycles of Each Frequency
  195.    Call Delay(Pause)
  196.    Call spChirp(220, 440, 10)
  197.    ' Makes a continuous Tone
  198.    ' 330  = Length (counts) for a 1/2 Cycle
  199.    ' 1000 = Number of Cycles or Duration
  200.    Call Delay(Pause)
  201.    Call spTone(330, 1000)
  202.    ' Create a hissing noise or White Noise
  203.    ' 1000000 = Total number of counts to delay.
  204.    Call Delay(Pause)
  205.    Call spNoise(1000000)
  206.    Call Delay(Pause)
  207.    Call spTone(110, 1000)
  208.    Call Delay(Pause)
  209.    Call spChirp(1000, 1, 3)
  210.    For i = 0 To 15
  211.       Call spChirp(1, 150, 2)
  212.    Next
  213.    ' starts a continuous tone
  214.    ' 440 = desired frequency
  215.    ' use spNosound to stop tone.
  216.    Call Delay(Pause)
  217.    Call spSound(440)
  218.    Call Delay(Pause)
  219.    Call spChirp(220, 440, 10)
  220.    Call Delay(Pause)
  221.    Call spTone(330, 1000)
  222.    Call Delay(Pause)
  223.    Call spNoise(1000000)
  224.    Call Delay(Pause)
  225.    Call spTone(110, 1000)
  226.    Call Delay(Pause)
  227.    Call spChirp(1000, 1, 3)
  228.    For i = 0 To 15
  229.      Call spChirp(1, 150, 2)
  230.    Next i
  231.    Call spChirp(1, 300, 2)
  232.    ' Terminate all Sound Functions
  233.    Call spNosound
  234. End Sub
  235.